import { BaseOper} from "@/api/base";
import request from "@/utils/request";
import axios from 'axios'
class Fio extends BaseOper{
    base='/api/v1/fio'

    Export = () => {
        let url = this.base+"/"+"export"
        axios({
            method: 'get',
            url: url,
            responseType: 'blob'
        }).then((response) => {
            const disposition = response.headers['content-disposition'];
            const matchArray = disposition.match(/filename=(.*)/);
            const filename = matchArray[1];
            const url = window.URL.createObjectURL(new Blob([response.data]));
            const link = document.createElement('a');
            link.href = url;
            link.setAttribute('download', filename);
            document.body.appendChild(link);
            link.click();
        })
    }
}

export const fio = new Fio()
